﻿using System.Collections.Generic;



namespace Crocodile.SimplexLanguage.Tree
{

    /// <summary>
    /// Simple file.
    /// </summary>
    public class SimplexFile : SimplexBlock
    {

        /// <summary>
        /// Name of file, related to the containing directory.
        /// Can be null.
        /// </summary>
        public string Name;


        /// <summary>
        /// Content of the file - top-level lines.
        /// </summary>
        public readonly IList<SimplexEntity> Content = new List<SimplexEntity>(1);


        int SimplexBlock.Offset
        {
            get { return -1; }
        }

        IList<SimplexEntity> SimplexBlock.Content
        {
            get { return Content; }
        }


        /// <summary>
        /// Checks whether the entity has at least one sub line.
        /// </summary>
        public bool HasContent { get { return Content.Count > 0; } }

        
        /// <summary>
        /// Trivial constructor.
        /// </summary>
        /// <param name="name">file name.</param>
        public SimplexFile(string name = null)
        {
            Name = name;
        }

    }
}
